package com.example.active.config;

import org.apache.activemq.command.ActiveMQQueue;
import org.apache.activemq.command.ActiveMQTopic;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.jms.annotation.EnableJms;

import javax.jms.Queue;
import javax.jms.Topic;

/**
 * @author 朝花不迟暮
 * @version 1.0
 * @date 2020/9/18 13:03
 */
@Configuration
@EnableJms //开启JMS适配
public class ConfigBean
{
    @Value("${myqueue}")
    private String queue;
    @Value("${myTopic}")
    private String topicName;

    @Bean
    public Queue queue()
    {
        return new ActiveMQQueue(queue);
    }

    @Bean
    public Topic topic(){
        return new ActiveMQTopic(topicName);
    }
}
